<template>
	<view class="item">
		<view class="left">
			<image :src="itemObj.coverUrl[0]?itemObj.coverUrl[0]:imgUrl" style='width: 210rpx; height: 140rpx;border-radius: 8rpx;'></image>
		</view>
		<view class="right">
			<view class="title">{{itemObj.activityTheme}}</view>
			<view class="right-type">
				{{typeClassArr[itemObj.activityType-1].name}}
				<text class="status">
					<!-- 0 草稿箱 1已发布   +++  1未开始 2进行中 3已结束  -->
					<!-- 草稿箱 -->
					<text v-if="isDrafts">
						<text v-if="itemObj.draftsStatus == 0" style="background: #aeaeaf;">未发布</text>
						<text v-if="itemObj.draftsStatus == 1" style="background: #51BB88;">草稿箱</text>
					</text>

					<!-- 列表 -->
					<text v-else>
						<text v-if="itemObj.activityStatus == 1" style="background: #3B95FF;">未开始</text>
						<text v-if="itemObj.activityStatus == 2" style="background: #51BB88;">进行中</text>
						<text v-if="itemObj.activityStatus == 3" style="background: #E86565;">已结束</text>
						<text v-if="!itemObj.activityStatus" style="background: #E86565;">未发布</text>
					</text>
				</text>
			</view>
			<view class="time">{{itemObj.createTime}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"playContain",
		props: {
			itemObj: {
				type: Object,
				default: {}
			},
			// 判断是不是草稿箱列表
			isDrafts: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {
				img: "",
				typeClassArr: [],
				type: '',
				imgUrl: '../../static/dangjian/no-pic.png'
			}
		},
		created() {
			this.img= "";
			this.typeClassArr = JSON.parse(uni.getStorageSync('typeClassArr'));
		},
		mounted() {
			if (typeof this.itemObj.coverUrl == "string") {
				this.itemObj.coverUrl = JSON.parse(this.itemObj.coverUrl);
			}
		},
		methods: {

		}
	}
</script>

<style>
	view,
	text {
		margin: 0;
		padding: 0;
	}

	.item {
		background: #F3F5F8;
		width: 100%;
		height: 180rpx;
		border-radius: 8rpx;
		margin-top: 20rpx;
		display: flex;
		align-items: center;
		padding: 10rpx 20rpx;
		box-sizing: border-box;
		border: 1px solid #D6DBE3;
	}

	.right {
		width: 100%;
		height: 140rpx;
		margin-left: 30rpx;
		font-size: 24rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: baseline;
	}

	.title {
		font-size: 32rpx;
		font-weight: bold;
		color: #000000;
	}

	.status {
		width: 90rpx;
		height: 32rpx;
		border-radius: 8rpx;
	}

	.status text {
		padding: 0 8rpx;
		border-radius: 8rpx;
		font-size: 18rpx;
		color: #FFFFFF;
	}

	.right-type {
		font-weight: 500;
		color: #000000;
	}

	.time {
		font-size: 24rpx;
		color: #999999;
	}
</style>
